package com.tshopping.controller;

import com.tshopping.service.UserService;
import com.tshopping.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;


/**
 * @name: UpdateInformationController
 * @description: 修改用户信息页面控制器
 * @author: Jackeys
 * @date: 2020-12-21 19:21
 */
@RestController
@RequestMapping("/UpdateInformationController")
@CrossOrigin
public class UpdateInformationController {
    @Autowired
    private UserService userService;

    @PostMapping(value = "/updateInformation")
    /**
     * @description 修改用户信息
     * @Param: screenName
     * @Param: name
     * @Param: sex
     * @Param: phone
     * @Param: email
     * @return  ResponseData
     * @author Jackeys
     * @date 2020-12-24 21:30
     */
    public ResponseData updateInformation(String screenName, String name, String sex, String phone, String email, String headPortrait) {
        return userService.updateInformation(screenName, name, sex, phone, email,headPortrait);
    }

    @PostMapping(value = "/uploadHeadPortrait")
    /**
     * @description 上传头像
     * @Param: email
     * @Param: file
     * @return ResponseData
     * @author Jackeys
     * @date 2021-01-03 12:18
     */
    public ResponseData uploadHeadPortrait(HttpServletRequest request,String email, @RequestParam(value = "file",required = false) MultipartFile file) {
       return userService.uploadHeadPortrait(request,email,file);
    }
}
